home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / ifp1s158.zip / PAGE_03.PAS < prev    next >
Pascal/Delphi Source File  |  1993-08-16  |  11KB  |  378 lines

  1. unit page_03;
  2.  
  3. interface
  4.  
  5. uses Crt, Dos, ifpglobl, ifpcomon, ifpextrn;
  6.  
  7. procedure page03;
  8.  
  9. implementation
  10.  
  11. procedure page03;
  12.  
  13. const
  14.   EMMint = $67;
  15.   qEMMdrvr = 'EMMXXXX0';
  16.   EMMerrs : array [$80..$A4] of string[55] = (
  17.         {80} 'internal error in EMM software',
  18.              'malfunction in expanded memory hardware',
  19.              'memory manager busy',
  20.              'invalid handle',
  21.              'undefined function',
  22.              'no more handles available',
  23.              'error in save or restore of mapping context',
  24.              'not enough physical pages available',
  25.         {88} 'not enough free pages available',
  26.              'no pages requested',
  27.              'logical page outside range assigned to handle',
  28.              'invalid physical page number',
  29.              'page map hardware state save area full',
  30.              'mapping context already in save area',
  31.              'mapping context not in save area',
  32.              'undefined subfunction parameter',
  33.         {90} 'attribute type not defined',
  34.              'feature not supported',
  35.              'src & dest overlap;move done, but source overwritten',
  36.              'length for src or dest longer than allocated',
  37.              'conventional and EMS memory overlap',
  38.              'offset outside logical page',
  39.              'region length >1M',
  40.              'src & dest overlap;not moved',
  41.         {98} 'src & dest types undefined',
  42.              'unused erro code',
  43.              'Alt map or DMA supported, but specified set isn''t',
  44.              'Alt map or DMA supported, but all allocated',
  45.              'Alt map or DMA not suported, specified set <> 0',
  46.              'Alt map or DMA suported, specified set <> 0',
  47.              'Dedicated DMA channels not supported',
  48.              'Dedicated DMA channels supported, but not specified one',
  49.         {A0} 'No handle found for specified name',
  50.              'handle with same name already exists',
  51.              '???',
  52.              'invalid pointer passed, or contents of source corrupted',
  53.              'access to function denied');
  54.  
  55. var
  56.   EMMarray : array[$000..$3FF] of word;
  57.   xlong : longint;
  58.   xword1 : word;
  59.   xword2 : word;
  60.   numhandles: word;
  61.   xstring : string;
  62.   EMMver, j: byte;
  63.   EMMname: array[1..8] of char;
  64.   isdpmi: boolean;
  65.   direc: directions;
  66.   ch2: char2;
  67.  
  68.   procedure EMMerr(a : byte);
  69.     begin
  70.     if (a >= $80) and (a <= $8F) then
  71.       Writeln(EMMerrs[a])
  72.     else
  73.       unknown('expanded memory error', a, 2)
  74.     end; {EMMerr}
  75.  
  76.   procedure showbcd(x: word);
  77.     var
  78.       c: char;
  79.  
  80.     begin
  81.     c:=Chr((x shr 12) + 48);
  82.     if c <> '0' then
  83.       Write(c);
  84.     Write(Chr(((x and $0F00) shr 8) + 48), decimal,
  85.       Chr(((x and $00F0) shr 4) + 48), Chr((x and $000F) + 48))
  86.     end; {showbcd}
  87.  
  88.   begin (* procedure page_03 *)
  89.   Caption2('Total conventional memory (bytes)  ');
  90.   Writeln(DOSmem: 6, ' (', DOSmem div 1024, 'K)');
  91.   Caption2('Free conventional memory (bytes)   ');
  92.   xlong:=DOSmem - (longint(PrefixSeg) shl 4);
  93.   Writeln(xlong: 6, ' (', xlong div 1024, 'K)');
  94.   Caption2('Extended memory (from BIOS call) ');
  95.   with regs do begin
  96.     AH:=$88;
  97.     Flags:=Flags and FCarry;
  98.     Intr($15, regs);
  99.     if nocarry(regs) then
  100.       Writeln(longint(AX) shl 10:8, ' (', AX, 'K)')
  101.     else
  102.       Writeln('     N/A')
  103.   end;
  104.   Caption2('XMS driver present ');
  105.   with regs do
  106.     begin
  107.     AX:=$4300;
  108.     Intr($2F, regs);
  109.     if AL <> $80 then
  110.       Writeln('no')
  111.     else
  112.       begin
  113.       Writeln('yes');
  114.       AX:=$4310;
  115.       Intr($2F, regs);
  116.       xlong:=longint(ES) shl 16 + BX;
  117.       Caption3('XMS version');
  118.       AX:=0;
  119.       LongCall(xlong, regs);
  120.       if AX <> 0 then
  121.         begin
  122.         showbcd(AX);
  123.         Caption3('XMM version');
  124.         showbcd(BX);
  125.         end
  126.       else
  127.         Write('ERROR');
  128.       Caption3('A20 is');
  129.       AX:=$0700;
  130.       LongCall(xlong, regs);
  131.       if (AX <> 0) or ((AX = 0) and (BL = 0)) then
  132.         case AX of
  133.           0: Writeln('disabled');
  134.           1: Writeln('enabled');
  135.         else
  136.           Writeln('unknown');
  137.         end
  138.       else
  139.         Write('ERROR');
  140.       Caption3('Total free XMS memory');
  141.       AX:=$0800;
  142.       LongCall(xlong, regs);
  143.       if (AX <> 0) or ((AX = 0) and ((BL = 0) or (BL = $A0))) then
  144.         begin
  145.         Write(DX, 'K');
  146.         Caption3('Largest available block');
  147.         Writeln(AX, 'K');
  148.         end
  149.       else
  150.         Writeln('ERROR');
  151.       Caption3('Upper memory Blocks');
  152.       AX:=$1000;
  153.       DX:=1;
  154.       LongCall(xlong, regs);
  155.       if (AX = 0) and (BL <> $B1) then
  156.         Writeln('no')
  157.       else
  158.         if (AX = 0) and (BL = $B1) then
  159.           Writeln('supported, but none available')
  160.         else
  161.           begin
  162.           Write('yes');
  163.           Caption3('Largest available size');
  164.           AX:=$1100;
  165.           DX:=BX;
  166.           LongCall(xlong, regs);
  167.           AX:=$1000;
  168.           DX:=$FFFF;
  169.           LongCall(xlong, regs);
  170.           Writeln(DX * longint(16), ' (', ((DX * 16.0) / 1024):1:1, 'K)');
  171.           end;
  172.       AX:=0;
  173.       LongCall(xlong, regs);
  174.       Caption3('HMA');
  175.       YesOrNo2(DX = 1);
  176.       AX:=$0100;
  177.       DX:=$FFFF;
  178.       LongCall(xlong, regs);
  179.       if AX = 0 then
  180.         Write(' (in use)')
  181.       else
  182.         Write(' (free)');
  183.       if (OSMajor >= 5) and (OSMajor < 10) then
  184.         begin
  185.         Caption3('Used by DOS');
  186.         AX:=$4A01;
  187.         BX:=0;
  188.         ES:=0;
  189.         DI:=0;
  190.         Intr($2F, regs);
  191.         YesOrNo2(BX <> 0);
  192.         if BX <> 0 then
  193.           begin
  194.           Caption3('bytes free');
  195.           Write(BX);
  196.           Caption3('at');
  197.           SegOfs(ES, DI);
  198.           end;
  199.         end;
  200.       Writeln;
  201.       end;
  202.     end;
  203.   isdpmi:=false;
  204.   Caption2('DPMI driver present');
  205.   with regs do
  206.     begin
  207.     AX:=$1687;
  208.     Intr($2F, regs);
  209.     if AX <> 0 then
  210.       Writeln('no')
  211.     else
  212.       begin
  213.       Writeln('yes');
  214.       isdpmi:=true;
  215.       Caption3('version');
  216.       Write(DH, decimal, DL);
  217.       Caption3('CPU');
  218.       case CL of
  219.         2: Write('286');
  220.         3: Write('386');
  221.         4: Write('486');
  222.         5: Write('P5')
  223.       else
  224.         Write('???')
  225.       end;
  226.       Caption3('switch mode entry');
  227.       SegOfs(ES, DI);
  228.       Writeln
  229.       end
  230.     end;
  231.   pause3(-12);
  232.   if endit then
  233.     Exit;
  234.   Caption2('Expanded memory');
  235.   if longint(intvec[EMMint]) <> $00000000 then
  236.     begin
  237.     Writeln;
  238.     Caption3('Interrupt vector');
  239.     xlong:=longint(intvec[EMMint]);
  240.     xword1:=xlong shr 16;
  241.     xword2:=xlong and $0000FFFF;
  242.     SegOfs(xword1, xword2);
  243.     Writeln;
  244.     Caption3('Driver');
  245.     xstring:='';
  246.     for i:=$000A to $0011 do
  247.       xstring:=xstring + showchar(Chr(Mem[xword1 : i]));
  248.     Write(xstring);
  249.     if xstring = qEMMdrvr then
  250.       begin
  251.       Caption3('status');
  252.       with regs do
  253.         begin
  254.         AH:=$40;
  255.         Intr(EMMint, regs);
  256.         if AH = $00 then
  257.           Write('available')
  258.         else
  259.           EMMerr(AH);
  260.         Caption3('version');
  261.         AH:=$46;
  262.         Intr(EMMint, regs);
  263.         if AH = $00 then
  264.           Writeln(AL shr 4, decimal, AL and $0F)
  265.         else
  266.           EMMerr(AH);
  267.         EMMver:=AL shr 4;
  268.         Caption3('Page frame segment');
  269.         AH:=$41;
  270.         Intr(EMMint, regs);
  271.         if AH = $00 then
  272.           Writeln(Hex(BX, 4))
  273.         else
  274.           EMMerr(AH);
  275.         Caption3('Total EMS memory');
  276.         AH:=$42;
  277.         Intr(EMMint, regs);
  278.         if AH = $00 then
  279.           begin
  280.           Write(longint(16) * DX, 'K');
  281.           Caption3('available');
  282.           if AH = $00 then
  283.             Writeln(longint(16) * BX, 'K')
  284.           else
  285.             EMMerr(AH)
  286.           end
  287.         else
  288.           EMMerr(AH);
  289.         if EMMver >= 4 then
  290.           begin
  291.           Caption3('VCPI capable');
  292.           {Check if Windows in enhanced mode. Don't do VCPI check if found.}
  293.           AX:=$1600;
  294.           Intr($2F, regs);
  295.           if AL in [0, 1, $80, $FF] then
  296. {          if not isdpmi then}
  297.             b